package meijuli.com.join51.business.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import meijuli.com.join51.business.R;
import meijuli.com.join51.business.fragment.WalletFragment;
import com.jhx.common.model.EventBean;
import org.greenrobot.eventbus.EventBus;

/**
 *
 *
 * @author wenqin 2017-05-05 09:48
 */

public class WalletActivity extends BaseActivity {
    TextView mToolbarTitle;
    TextView mTextMenu;
    Toolbar mToolbar;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_base_fragment);
        mToolbarTitle = findViewById(R.id.toolbar_title);
        mTextMenu = findViewById(R.id.text_menu);
        mToolbar = findViewById(R.id.toolbar);
        initToolBar();

        addFragment(new WalletFragment());
    }

    private void initToolBar() {
        mToolbar.setTitle("");
        mToolbarTitle.setText("钱包");
        mToolbar.setNavigationIcon(R.mipmap.icon_back_white);
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!getSupportFragmentManager().popBackStackImmediate()) {
                    finish();
                }
            }
        });
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        // 返回页面的时候刷新钱包数据
        EventBus.getDefault().post(new EventBean<>(EventBean.STATUS_UPDATE_WALLET));
    }
}
